{% extends 'accounts/auth_base.html' %}

{% block title %}用户登录{% endblock %}

{% block content %}
<div class="row justify-content-center position-relative flex-grow-1" style="z-index: 1;">
    <div class="col-12 d-flex align-items-center">
        <div class="card border-0 shadow-lg w-100" style="border-radius: 25px; overflow: hidden; background-color: rgba(255, 255, 255, 0.85);">
            <div class="card-body p-5">
                <div class="text-center mb-5">
                    <div class="mb-4">
                        <div class="bg-gradient-primary rounded-circle mx-auto d-flex align-items-center justify-content-center" 
                             style="width: 90px; height: 90px; box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);">
                            <i class="fas fa-user-lock text-white" style="font-size: 2.8rem;"></i>
                        </div>
                    </div>
                    <h2 class="h3 fw-bold text-dark mb-2">欢迎回来</h2>
                    <p class="text-muted mb-4">请登录您的账户</p>
                </div>
                
                {% if messages %}
                    {% for message in messages %}
                        <div class="alert alert-{{ message.tags }} alert-dismissible fade show rounded-pill px-4 py-3 mb-4 shadow-sm" role="alert">
                            <i class="fas fa-info-circle me-2"></i>{{ message }}
                            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                        </div>
                    {% endfor %}
                {% endif %}
                
                <form method="post" class="text-start">
                    {% csrf_token %}
                    <div class="mb-4">
                        <label for="username" class="form-label fw-semibold text-dark mb-2">
                            <i class="fas fa-user me-2 text-primary"></i>用户名
                        </label>
                        <div class="input-group">
                            <input type="text" 
                                   class="form-control form-control-lg border-0 py-3 shadow-sm" 
                                   id="username" 
                                   name="username" 
                                   placeholder="请输入用户名" 
                                   required 
                                   style="border-radius: 15px; background-color: #f8f9fa;">
                        </div>
                    </div>
                    
                    <div class="mb-4">
                        <label for="password" class="form-label fw-semibold text-dark mb-2">
                            <i class="fas fa-lock me-2 text-primary"></i>密码
                        </label>
                        <div class="input-group">
                            <input type="password" 
                                   class="form-control form-control-lg border-0 py-3 shadow-sm" 
                                   id="password" 
                                   name="password" 
                                   placeholder="请输入密码" 
                                   required 
                                   style="border-radius: 15px; background-color: #f8f9fa;">
                        </div>
                    </div>
                    
                    <div class="d-grid mt-5">
                        <button type="submit" 
                                class="btn btn-primary btn-lg py-3 rounded-pill fw-semibold shadow-lg" 
                                style="letter-spacing: 1px; transition: all 0.3s;">
                            <i class="fas fa-sign-in-alt me-2"></i>登录
                        </button>
                    </div>
                </form>
            </div>
            
            <div class="card-footer border-0 text-center py-4">
                <p class="mb-0 text-muted">
                    没有账户? 
                    <a href="{% url 'accounts:register' %}" class="text-decoration-none fw-bold text-primary">
                        立即注册
                    </a>
                </p>
            </div>
        </div>
    </div>
</div>
<div class="row justify-content-center">
    <div class="col-12 text-center mb-4">
        <p class="text-white mb-0" style="text-shadow: 0 2px 4px rgba(0,0,0,0.1); font-weight: 500;">
            &copy; 2025 RBAC权限管理系统
        </p>
    </div>
</div>
{% endblock %}